package org.doubango.ngn.services.facade;

import java.util.ArrayList;

import org.doubango.ngn.services.impl.NgnBaseService;

/**
 * @author dpGroup
 *
 */
public class NgnServiceFacadeGeneric {

	private ArrayList<NgnBaseService> serviceList = new ArrayList<NgnBaseService>();
	
	public NgnServiceFacadeGeneric(ArrayList<NgnBaseService> serviceList ) {
		this.serviceList.addAll(serviceList);
	}
	
	public void addService(NgnBaseService service){
		this.serviceList.add(service);
	}
	
	public void removeService(NgnBaseService service){
		this.serviceList.remove(service);
	}
	
	public void removeAllService(){
		this.serviceList.clear();
	}
	
	
	public boolean startAllServices(){
		boolean retFlag = true;
		
		for(NgnBaseService service : this.serviceList){
			retFlag &= service.start();
		}		
		
		return retFlag;
	}
	
	public boolean stopAllServices(){
		boolean retFlag = true;
		
		for(NgnBaseService service : this.serviceList){
			retFlag &= service.stop();
		}		
		
		return retFlag;
		
	}	
	
		
}
